import request from "@/utils/request.js";

// 获取电影列表
export function getMovieList(params) {
    return request({
        url: `movie/api/movies/list`,
        method: 'get',
        params
    })
}

// 上传Excel文件
export function uploadExcel(formData) {
    return request({
        url: `movie/api/movies/upload`,
        method: 'post',
        data: formData,
        headers: { 'Content-Type': 'multipart/form-data' },
    })
}

// 根据名称获取JSON
export function getMovieJson(name) {
    return request({
        url: `movie/api/movies/show/${name}`,
    })
}

// 单个删除
export function movieDelete(id) {
    return request({
        url: `movie/api/movies/${id}`,
        method: 'delete'
    })
}

// 批量删除
export function moviesBatchDelete(ids) {
    return request({
        url: `movie/api/movies/batch`,
        method: 'delete',
        data: ids
    })
}

// 根据名称获取JSON
export function moviesExport(ids) {
    return request({
        url: `movie/api/movies/export`,
        method: 'post',
        data: ids
    })
}

// 获取任务进度
export function fetchBatchProgress(id) {
    return request({
        url: `movie/api/movies/batch/${id}/progress`,
        method: 'get',
    })
}